/*
-----------------------------------------------------------------------------
This source file is part of Labor3D
(Labor 3D Graphics Engine)

Copyright (c) 2009-2020 Rock Mao
* creator : Rock Mao
* created : 2009-5-4   16:29
* filename: LaborD3D10Plugin.cpp
-----------------------------------------------------------------------------
*/

#include "LaborD3D10Plugin.h"
#include "LaborCore.h"
#include "Common/LaborHashString.h"

const CLString strPluginName = L"D3D10 RenderSystem";

//---------------------------------------------------------------------
CLD3D10Plugin::CLD3D10Plugin()
: m_pRenderSystem(0)
{

}
//---------------------------------------------------------------------
const CLString& CLD3D10Plugin::getName() const
{
	return strPluginName;
}
//---------------------------------------------------------------------
void CLD3D10Plugin::install()
{
	// Create the DirectX 9 rendering api
#ifdef LABOR_STATIC_LIB
	HINSTANCE hInst = GetModuleHandle( NULL );
#else
#  ifdef DEBUG
	HINSTANCE hInst = GetModuleHandleA( "LaborD3D10D.dll" );
#  else
	HINSTANCE hInst = GetModuleHandleA( "LaborD3D10.dll" );
#  endif
#endif
	m_pRenderSystem = new CLD3D10RenderSystem( hInst );
	// Register the render system
	GetLaborCore()->addRenderSystem( m_pRenderSystem );
	getPluginInfo( &m_pluginInfo );

}
//---------------------------------------------------------------------
void CLD3D10Plugin::initialise()
{
	int i=0;
	// nothing to do
}
//---------------------------------------------------------------------
void CLD3D10Plugin::destory()
{
	// nothing to do
}
//---------------------------------------------------------------------
void CLD3D10Plugin::uninstall()
{
	SafeDelete(m_pRenderSystem);
}

//---------------------------------------------------------------------
void CLD3D10Plugin::getPluginInfo(slPluginInfo* pluginfo)
{
	pluginfo->m_Build = 0;
#ifdef _DEBUG 
	pluginfo->m_Build |= eBuild_Debug;
#endif
	pluginfo->m_ID = 102;
	pluginfo->m_Type = ePT_Renderer;
	strncpy(pluginfo->m_Description, "Rock's D3D10 Renderer , Direct3D Version 10.0" , 256);
	strncpy(pluginfo->m_Name,"D3D10 Renderer",32);

	sHashValue _value;
	CLHashCodeTable::singleton().string_hash("D3D10 Renderer",_value);
	pluginfo->m_ID = _value.indexHash;
}
